package com.rc.scripting.plugin;

/**
 * <p>
 * The interface <code>Plugin</code> is used to defined the basic behavior of
 * a plug-in, which has name, description, status. and could be active, or
 * active by a context.
 * </p>
 * @author juntao.qiu@gmail.com
 * @date 2010-5-13
 */
public interface Plugin {
	/**
	 * The plug-in is loaded only, need to be actived
	 */
	final String STATUS_LOADED = "loaded";
	
	/**
	 * The plug-in is actived, executed at least once already
	 */
	final String STATUS_ACTIVE = "active";
	
	/**
	 * get the name of plug-in
	 * @return
	 */
	String getName();
	
	/**
	 * get the description of plug-in 
	 * @return
	 */
	String getDescription();
	
	/**
	 * get the status of plug-in, may be :
	 * <code>STATUS_LOADED</code> or <code>STATUS_ACTIVE</code>
	 * @return
	 */
	String getStatus();
	
	/**
	 * active plug-in, execute the script, then return the result
	 * @return
	 */
	Object activate();
	
	/**
	 * active plug-in with context, some attributes binded in it
	 * @param context
	 * @return
	 */
	Object activate(Context context);
}
